package com.qhzz.iocdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.qhzz.iocdemo.annotation.ContentView;
import com.qhzz.iocdemo.annotation.OnClick;
import com.qhzz.iocdemo.annotation.OnLongClick;
import com.qhzz.iocdemo.annotation.ViewInject;

@ContentView(R.layout.activity_main)
public class MainActivity extends AppCompatActivity {

    @ViewInject(R.id.tv)
    private TextView tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        InjectUtils.inject(this);
        tv.setText("注解成功");

    }
    @OnClick(R.id.tv)
    public void showToast(View view) {
//        switch (view.getId()) {
//            case R.id.tv:
//                tv.setText("点击成功");
//                break;
//        }
//        Toast.makeText(this, "显示Toast" + view, Toast.LENGTH_SHORT).show();
        Log.e("AAA—>", "showToast: " );
    }
    @OnLongClick(R.id.tv)
    public boolean showLongToast(View view) {
        Toast.makeText(this, "长按", Toast.LENGTH_SHORT).show();
        return true;
    }
}
